Maintainable Type Classes for Haskell
نویسنده
چکیده
This paper addresses a long-term maintainability problem in Haskell type class system. In particular, we study a possibility of backward-compatible changes of existing class hierarchies. We summarize current proposed solutions to the problem and analyze their properties. Based on this analysis we derive our own language extension. We discuss several possible applications of the language extension and compare the extension to other solutions. As a part of the paper we also give an implementation of the extension for the GHC compiler.
منابع مشابه
An Exploration of Modular Programs
Recently, Mark Jones introduced first class structures as a means to express modular structure. In this paper we elaborate on this idea by comparing the module systems of Standard ML and Haskell 1.3, two widely used functional languages, and a Haskell variant equipped with such first class structures. Moreover, we look at another obvious and well-known extension to Hindley-Milner type systems, ...
متن کاملType Classes and Constraint Handling Rules
Type classes are an elegant extension to traditional, Hindley-Milner based typing systems. They are used in modern, typed languages such as Haskell to support controlled overloading of symbols. Haskell 98 supports only single-parameter and constructor type classes. Other extensions such as multi-parameter type classes are highly desired but are still not officially supported by Haskell. Subtle ...
متن کاملObjects to Unify Type Classes and GADTs
We propose an Haskell-like language with the goal of unifying type classes and generalized algebraic datatypes (GADTs) into a single class construct. We treat classes as first-class types and we use objects (instead of type class instances and data constructors) to define the values of those classes. We recover the ability to define functions by pattern matching by using sealed classes. The res...
متن کاملNamed Instances for Haskell Type Classes
Although the functional programming language Haskell has a powerful type class system, users frequently run into situations where they would like to be able to define or adapt instances of type classes only after the remainder of a component has been produced. However, Haskell’s type class system essentially only allows late binding of type class constraints on free type variables, and not on u...
متن کاملType classes: an exploration of the design space
When type classes were rst introduced in Haskell they were regarded as a fairly experimental language feature, and therefore warranted a fairly conservative design. Since that time, practical experience has convinced many programmers of the bene ts and convenience of type classes. However, on occasion, these same programmers have discovered examples where seemingly natural applications for type...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2015